# 计科1915班 0306224505 屠玉宝


import random

with open('名单1.txt', 'r', encoding='utf-8') as f:
    lst = f.read().splitlines()

selected_student = random.choice(lst)
print("被选中的学生是：", selected_student)
lst.remove(selected_student)

with open('名单1.txt', 'w', encoding='utf-8') as f:
    for name in lst:
        f.write(name + "\n")

with open('完成名单.txt', 'a', encoding='utf-8') as f:
    f.write(selected_student + "\n")
